// Config.h
#pragma once
#ifndef CONFIG_H
#define CONFIG_H


// WiFi配置
// 声明为extern
extern const char* ssid;
extern const char* password;


// OneNET MQTT配置
extern const char* mqtt_server;
extern const int mqtt_port;


// OneNET Topic格式定义
//#define ONENET_TOPIC_PROP_FORMAT "{\"id\":\"%u\",\"version\":\"1.0\",\"params\":{\"humid\":{\"value\":%d},\"temp\":{\"value\":%.1f},\"smoke_level\":{\"value\":%.1f},\"human_detect\":{\"value\":%s},\"f_btn\":{\"value\":%s}}}"
#define ONENET_TOPIC_PROP_POST "$sys/%s/%s/thing/property/post"
#define ONENET_TOPIC_PROP_SET "$sys/%s/%s/thing/property/set"
#define ONENET_TOPIC_PROP_SET_REPLY "$sys/%s/%s/thing/property/set_reply"
#define ONENET_TOPIC_PROP_POST_REPLY "$sys/%s/%s/thing/property/post_reply"
#define ONENET_TOPIC_PROP_FORMAT \
    "{\"id\":\"%d\",\"version\":\"1.0\",\"params\":{" \
    "\"humid\":{\"value\":%d}," \
    "\"temp\":{\"value\":%.1f}," \
    "\"smoke_level\":{\"value\":%.1f}," \
    "\"human_detect\":{\"value\":%s}," \
    "\"f_btn\":{\"value\":%s}," \
    "\"lgt_p\":{\"value\":%s}}}"

// 硬件引脚定义（统一命名）
// 硬件引脚定义
#define LED 2
#define DHTPIN 25       // DHT11数据引脚
#define BUZZER_PIN 5    // 蜂鸣器引脚
#define MOTION_PIN 13   // 人体传感器引脚
#define FAN_PIN 26      // 风扇控制引脚
#define FLAME_SENSOR_PIN 2     // 火焰传感器数字输出
#define MQ2_AO_PIN 34          // MQ-2模拟输入
#define MQ2_DO_PIN 35          // MQ-2数字输出
#define LIGHT_SENSOR_PIN 32    // 光敏电阻引脚
#define LED_PIN 33       // LED引脚

#define FLAME_AO_PIN 4  // 火焰传感器模拟输出
#define FLAME_DO_PIN 2  // 火焰传感器数字输出


#define SMOKE_THRESHOLD 5000.0  // 烟雾报警阈值(ppm)

// 温度阈值(℃)
#define TEMP_THRESHOLD 30
#endif // CONFIG_H